﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vortex.Drawing {

	/// <summary>
	/// Implementation of drawing device for multiple target windows support. It doesn't support fullscreen and verical sync.
	/// </summary>
	public class MultiContextDevice : DrawingDevice {

		/// <summary>
		/// Initializes a new instance of the <see cref="MultiContextDevice"/> class.
		/// </summary>
		/// <param name="windowHandle">The primary window handle. (It is used only for hosting internal drawing device). </param>
		public MultiContextDevice(IntPtr windowHandle)
			: base(windowHandle, 1, 1, false, false) {
		}

		/// <summary>
		/// Creates the drawing context for specified window by handle.
		/// </summary>
		/// <param name="targetWindowHandle">The target window handle.</param>
		/// <returns>
		/// Drawing context targeted to specified window
		/// </returns>
		public DrawingContext CreateContext(IntPtr targetWindowHandle) {
			return new DrawingContext(targetWindowHandle, System.Drawing.Size.Empty, false);
		}

		/// <summary>
		/// Creates the drawing context for specified window by handle.
		/// </summary>
		/// <param name="targetWindowHandle">The target window handle.</param>
		/// <param name="createZBuffer">if set to <c>true</c> Z-buffer will be created for this context.</param>
		/// <returns>
		/// Drawing context targeted to specified window
		/// </returns>
		public DrawingContext CreateContext(IntPtr targetWindowHandle, bool createZBuffer) {
			return new DrawingContext(targetWindowHandle, System.Drawing.Size.Empty, createZBuffer);
		}

		/// <summary>
		/// Creates the drawing context for specified window by handle without Z-buffer.
		/// </summary>
		/// <param name="targetWindowHandle">The target window handle.</param>
		/// <param name="size">The explicit size of context surface buffer.</param>
		/// <returns>
		/// Drawing context targeted to specified window
		/// </returns>
		public DrawingContext CreateContext(IntPtr targetWindowHandle, System.Drawing.Size size) {
			return new DrawingContext(targetWindowHandle, size, false);
		}

		/// <summary>
		/// Creates the drawing context for specified window by handle.
		/// </summary>
		/// <param name="targetWindowHandle">The target window handle.</param>
		/// <param name="size">The explicit size of context surface buffer.</param>
		/// <param name="createZBuffer">if set to <c>true</c> Z-buffer will be created for this context.</param>
		/// <returns>
		/// Drawing context targeted to specified window
		/// </returns>
		public DrawingContext CreateContext(IntPtr targetWindowHandle, System.Drawing.Size size, bool createZBuffer) {
			return new DrawingContext(targetWindowHandle, size, createZBuffer);
		}

	}
}
